package info.manxi;

import akka.actor.AbstractActor;
import akka.actor.ActorRef;
import akka.actor.PoisonPill;
import akka.actor.Props;

/**
 * <pre>
 * <b>Description</b>
 * </pre>
 * <pre>
 * 创建时间 2019-11-25 15:37
 * 所属工程： akka-actor-101  </pre>
 *
 * @author sheldon yhid: 80752866
 */
public class Girl extends AbstractActor {
    static Props props() {
        return Props.create(Girl.class, Girl::new);
    }

    @Override
    public Receive createReceive() {
        return receiveBuilder()
                .matchAny(msg -> {
                    print("我收到了" + getSender() + "的消息： " + msg);
//                    print("我放弃了");
//                    getSelf().tell(PoisonPill.getInstance(), getSelf());
                })
                .build();
    }

    private void print(Object obj) {
        System.out.println("姑娘说：" + obj);
    }

}
